type FindMapToValue<
  T extends Record<"mapFrom" | "mapTo", any>,
  Value,
  U = T
> = T extends U ? (Value extends T["mapFrom"] ? T["mapTo"] : never) : never;

type test = FindMapToValue<
  { mapFrom: 1; mapTo: 11 } | { mapFrom: 2; mapTo: 22 },
  2
>;

type MapTypes<T, R extends Record<"mapFrom" | "mapTo", any>> = {
  [P in keyof T]: T[P] extends R["mapFrom"] ? FindMapToValue<R, T[P]> : T[P];
};
